import { View } from "../../../mvc/core/View";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ImagesConst } from "../../resource/ImagesConst";
import { Cache } from "../../cache/Cache";
import { ClockManager } from "../../manager/ClockManager";
type int = number;
//class WeekIncome
    
    export  class WeekIncome extends View
    {
        constructor()
        {
            super();
            this.dateTextFeildList = [];
            this.coinTextFeildList = [];
            this.goldTextFeildList = [];
            this.coinBmdList = [];
            this.goldBmdList = [];
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            ObjCreate.createTextField(Language.getString(85058), 52, 67, 34, 17, this, GlobalStyle.textFormat6, false, false);
            ObjCreate.createTextField(Language.getString(85059), 174, 67, 60, 17, this, GlobalStyle.textFormat6, false, false);
            ObjCreate.createTextField(Language.getString(85060), 310, 67, 60, 17, this, GlobalStyle.textFormat6, false, false);
            var loc1=GlobalStyle.textFormat1;
            loc1.align = flash.text.TextFormatAlign.RIGHT;
            this.createItem(0, Language.getString(85061), loc1);
            this.createItem(1, Language.getString(85062), loc1);
            this.createItem(2, Language.getString(85063), loc1);
            this.createItem(3, Language.getString(85064), loc1);
            this.createItem(4, Language.getString(85065), loc1);
            this.createItem(5, Language.getString(85066), loc1);
            this.createItem(6, Language.getString(85067), loc1);
            return;
        }

        /* internal  */createItem(arg1: int, arg2: string, arg3: Object /* flash.text.TextFormat */): void
        {
            var loc1=88 + arg1 * 36;
            ObjCreate.createBg(0, loc1 + 36, 392, 1, this, ImagesConst.KillUserLine);
            this.dateTextFeildList[arg1] = ObjCreate.createTextField(arg2, 46, loc1 + 13, 60, 17, this, null, false, false);
            this.coinTextFeildList[arg1] = ObjCreate.createTextField("12345678", 140, loc1 + 13, 80, 17, this, arg3, false, false);
            this.goldTextFeildList[arg1] = ObjCreate.createTextField("12345678", 275, loc1 + 13, 80, 17, this, arg3, false, false);
            this.coinBmdList[arg1] = ObjCreate.createBitmap(ImagesConst.Tongqian_small, 220, loc1 + 14, this);
            this.goldBmdList[arg1] = ObjCreate.createBitmap(ImagesConst.Yuanbao_small, 358, loc1 + 12, this);
            return;
        }

        public updateData(arg1: Boolean): void
        {
            var loc1=null;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            var loc10=null;
            var loc11=0;
            var loc12=0;
            var loc2=Cache.instance.crossCityIncome;
            if (arg1) 
            {
                loc1 = loc2.thisWeekInfos;
            }
            else 
            {
                loc1 = loc2.preWeekInfos;
            }
            var loc8=1000;
            if (arg1) 
            {
                loc8 = ClockManager.instance.nowDate.day;
            }
            var loc9=1;
            while (loc9 <= 7) 
            {
                loc12 = (loc11 = (loc10 = loc1[loc9]).DayType - 1);
                loc3 = this.dateTextFeildList[loc12];
                loc4 = this.coinTextFeildList[loc12];
                loc5 = this.goldTextFeildList[loc12];
                loc6 = this.coinBmdList[loc12];
                loc7 = this.goldBmdList[loc12];
                var loc13;
                loc5.textColor = loc13 = GlobalStyle.color1Uint;
                loc4.textColor = loc13 = loc13;
                loc3.textColor = loc13;
                loc7.visible = loc13 = true;
                loc6.visible = loc13;
                loc4.text = String(loc10.coin);
                loc5.text = String(loc10.gold);
                if (loc11 != loc8) 
                {
                    if (loc11 > loc8) 
                    {
                        loc7.visible = loc13 = false;
                        loc6.visible = loc13;
                        loc4.text = loc13 = Language.getString(85068);
                        loc5.text = loc13;
                    }
                }
                else 
                {
                    loc5.textColor = loc13 = GlobalStyle.color5Uint;
                    loc4.textColor = loc13 = loc13;
                    loc3.textColor = loc13;
                }
                ++loc9;
            }
            return;
        }

        /* internal */ /* var */dateTextFeildList: Array<any>;

        /* internal */ /* var */coinTextFeildList: Array<any>;

        /* internal */ /* var */goldTextFeildList: Array<any>;

        /* internal */ /* var */coinBmdList: Array<any>;

        /* internal */ /* var */goldBmdList: Array<any>;
    }
